Modify The Http Status In Mule 4
In this tutorial we will demonstrate how can we modify the Http status In Mule 4
To modify the status we have created a sample Rest API in mulesoft and deploy the same on local environment Please visit how to create Rest API
Sample Mulesoft application:
Deploy the mulesoft application and test without setting the HttpStatus hence it will send the HttpStatus as 500 Internal Server Error as we are testing with wrong empId
Now if you want to change the HttpStatus from 500 to 400(Bad Request), Please follow the below step
Add the variable under on error propagate and give the name of the variable as httpStatus and value as 400
Deploy the application and test
Sample application: change http status sample application
Soapui project: ChangeHttpStatus-soapui-project
Thanks
This is a great example. Thank you.